Skip to content

fix(chat): hide message actions on content-less messages (compact subagent cards)#721

Open
blove wants to merge 1 commit into
mainfrom
fix/subagent-card-no-actions
Open

fix(chat): hide message actions on content-less messages (compact subagent cards)#721
blove wants to merge 1 commit into
mainfrom
fix/subagent-card-no-actions

Conversation

@blove

@blove blove commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Problem

A subagent delegation renders as its own assistant message whose only content is the subagent card (no assistant text). That message was still getting the full message-actions toolbar — regenerate / copy / 👍 / 👎 — which is pure whitespace there (nothing to copy, regenerate, or rate) and bloats the message stream.

Fix

Gate <chat-message-actions> on the message having copyable text (@if (content.trim())). Content-less messages — subagent cards and bare tool-call messages — now render compact; real answers keep their actions.

Verification (live, examples/ag-ui research subagent)

Drove the running app and inspected the DOM before/after:

  • Before: two "Message actions" toolbars — one right after the research subagent card (the delegation message) + one after the answer.
  • After: one toolbar, only after the answer. The subagent card has none.

One-line template gate; @threadplane/chat builds green. (The existing chat.component.spec intentionally avoids full-DOM fixtures due to the required [agent] input, so this was verified via live smoke rather than a brittle DOM unit test.)

🤖 Generated with Claude Code

…agent cards)

A subagent delegation renders as its own assistant message whose only content is
the subagent card (no assistant text). It was still getting the full message-
actions toolbar (regenerate/copy/thumbs up/down) — pure whitespace, since there
is nothing to copy/regenerate/rate — which bloated the stream.

Gate <chat-message-actions> on the message having copyable text (`content.trim()`).
Subagent cards and bare tool-call messages now render compact; real answers keep
their actions.

Verified live in examples/ag-ui (research subagent): the delegation card's actions
toolbar is gone; the answer message retains exactly one actions toolbar.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@blove blove enabled auto-merge (squash) June 20, 2026 02:42
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jun 20, 2026 3:20am

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 1m 4s —— View job


Code Review

  • Gather context (CLAUDE.md, PR diff, changed files)
  • Review the change for correctness, type safety, and Angular pitfalls
  • Post findings

LGTM. The fix is clean, minimal, and correct.

What was checked:

  • content is typed as string (guaranteed by messageContent()extractText() which always returns string), so content.trim() is type-safe and can't throw.
  • The gate only affects messages where messageContent returns empty/whitespace — i.e. subagent delegation cards and bare tool-call messages. Real assistant replies with text continue to get the full actions panel.
  • No Angular pitfalls: @let content is a plain string, not a signal — no subscription leak, no CD misuse. The trim() call in the template is trivially cheap.
  • Streaming case is handled correctly: the actions panel will be absent while a message is still empty and appear once non-whitespace text arrives — which is strictly better than before.
  • One implicit side-effect: assistant messages that contain only an a2ui spec (no text) will also lose the actions bar. That seems intentional and consistent with the stated goal (nothing to copy/regenerate/rate in that case either).

The verbose block comment added is consistent with the existing comment style in this template (there are several others explaining subtle behaviour). No issues with that.

No test coverage gap: the PR correctly notes that the chat.component.spec avoids full-DOM fixtures; the change is a one-line template gate that's straightforwardly verified by live smoke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant